package com.demo.gulimall.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Elasticsearch 相关配置类
 * @author Chen Yuan
 * @create 2023-05-25  15:36
 */
@Configuration
public class MallElasticSearchConfig {

	public static final RequestOptions COMMON_OPTIONS;
	static {
		RequestOptions.Builder builder = RequestOptions.DEFAULT.toBuilder();
		COMMON_OPTIONS = builder.build();
	}


	@Bean
	public RestHighLevelClient esRestClient(){
		return new RestHighLevelClient(
				RestClient.builder(
						new HttpHost("39.106.206.145", 9200, "http")
				)
		);
	}
}
